package com.movie.index.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.entity.film.Movie;
import com.movie.index.mapper.MovieMapper;
import com.movie.index.service.IMovieService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yzw
 * @since 2021-04-13
 */
@RestController
@RequestMapping("/index/movie")
public class MovieController {


        @Autowired
        private IMovieService iMovieService;


    /**
     * 首页数据查的是数据库
     * @param id
     * @return
     */
    @RequestMapping("findContetByCid")
    public List<Movie> findContetByCid(Integer id){
        //设置分页
        IPage<Movie> iPage = new Page<>(1,3);


        QueryWrapper<Movie> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("movie_id",id);

        IPage<Movie> pageInfo = iMovieService.page(iPage, queryWrapper);

        return pageInfo.getRecords();

    }
}
